/**
 * @file app store
 * @author
 */

import http from '@/api';
import queryString from 'query-string';

export default {
  namespaced: true,
  state: {
  },
  mutations: {
  },
  actions: {
    getTableData(context, params, config = {}) {
      // eslint-disable-next-line no-undef
      return http.get(`/api/table?&${queryString.stringify(params)}`, params, config);
    },
    		// 查询业务列表
    getBizData(context, params, config = {}) {
      // eslint-disable-next-line no-undef
      //本地后端开发环境 http://dev.ce.bktencent.com:8000
      // return http.get(`http://dev.ce.bktencent.com:8000/biz-list`, params, config);
      //部署运行环境 https://apps.ce.bktencent.com/stag--lessons2-back/
      return http.get(`https://apps.ce.bktencent.com/stag--lessons2-back/biz-list`, params, config);

    },
    // 根据业务ID，查询集群列表
    getSetData(context, params, config = {}) {
      // eslint-disable-next-line no-undef
      //本地后端开发环境 http://dev.ce.bktencent.com:8000
      // const url = `http://dev.ce.bktencent.com:8000/set-list?${queryString.stringify(params)}`;
       //后端部署运行环境 https://apps.ce.bktencent.com/stag--lessons2-back/
      const url = `https://apps.ce.bktencent.com/stag--lessons2-back/set-list?${queryString.stringify(params)}`;
      return http.get(url, {}, config);
    },
    // 根据业务ID和集群ID，查询模块列表
    getModuleData(context, params, config = {}) {
      // eslint-disable-next-line no-undef
      //本地后端开发环境 http://dev.ce.bktencent.com:8000
      // const url = `http://dev.ce.bktencent.com:8000/module-list?${queryString.stringify(params)}`;
      //后端部署运行环境 https://apps.ce.bktencent.com/stag--lessons2-back/
      const url = `https://apps.ce.bktencent.com/stag--lessons2-back/module-list?${queryString.stringify(params)}`;
      return http.get(url, {}, config);
    },
    getHostsData(context, params, config = {}){
      //本地后端开发环境 http://dev.ce.bktencent.com:8000
      // const url =`http://dev.ce.bktencent.com:8000/host-list?${queryString.stringify(params)}`;
      //后端部署运行环境 https://apps.ce.bktencent.com/stag--lessons2-back/
      const url =`https://apps.ce.bktencent.com/stag--lessons2-back/host-list?${queryString.stringify(params)}`;
      return http.get(url, {}, config);
    },
     getHostDetail(context, params, config = {}){
      //本地后端开发环境 http://dev.ce.bktencent.com:8000
      // const url =`http://dev.ce.bktencent.com:8000/host-detail?${queryString.stringify(params)}`;
      //后端部署运行环境 https://apps.ce.bktencent.com/stag--lessons2-back/
      const url =`https://apps.ce.bktencent.com/stag--lessons2-back/host-detail?${queryString.stringify(params)}`;
      return http.get(url, {}, config);
    },
  },
};


